#ifndef Define_LcVideoRead
#define Define_LcVideoRead

#include <cstring>
#include <opencv2/opencv.hpp>
#include <opencv2/flann/config.h>

#include <opencv2/legacy/legacy.hpp>		// EM
#include <opencv2/contrib/contrib.hpp>		// colormap
#include <opencv2/nonfree/nonfree.hpp>		// SIFT

using namespace std;
using namespace cv;

class LcVideoRead
{
public:

	LcVideoRead();
	string root;
	string video_name;
	string ext;
	int f_start;
	int f_end;
	int f_rate;
	int t_win;
	int f;
	int veb;

	double scale;

	VideoCapture cap;

	void open();
	int read(Mat & frm);
	int readNext(Mat & frm);
	void reset();

	void getLabel(Mat & lab);
	//get label img(ground truth)

	int getf();

	int read_one_frame(Mat & frm);
};


//========================
// different from LcVideoRead class
//
// the extended one will update a path which from t-t_win to t+t_win

class LcVideoReadExt: public LcVideoRead
{
public:

	static bool IF_GRAY; // if it's true, it will return a gray image array
	

	int read(Mat & frm);
	int readNext(Mat & frm);

	int read(Mat & frm, vector<Mat> * frm_array);
	int readNext(Mat & frm, vector<Mat> * frm_array);

	void getfrms( vector<Mat> * frm_array);

	void reset();

private:
	void array_init();

	vector<Mat> img_array; // the path
	int loop_id;

	int loop_add(int loop_id,int i = 1);
	int loop_minus(int loop_id,int i = 1);

	void shift_add(Mat frm); // updata
};

void testLcVideoRead();
void testLabelRead();



#endif